package com.yanmaohu.yulia.statement;

import com.yanmaohu.yulia.bean.SimpleValueSpecification;

/**
 * @author Bright Lee
 */
public final class ConnectStatement implements SqlConnectionStatement, Statement {

    private int beginIndex;
    private int endIndex;
    private SimpleValueSpecification sqlServerName;
    private SimpleValueSpecification connectionName;
    private SimpleValueSpecification connectionUserName;

    public ConnectStatement(int beginIndex,
                            int endIndex,
                            SimpleValueSpecification sqlServerName,
                            SimpleValueSpecification connectionName,
                            SimpleValueSpecification connectionUserName) {
        this.beginIndex = beginIndex;
        this.endIndex = endIndex;
        this.sqlServerName = sqlServerName;
        this.connectionName = connectionName;
        this.connectionUserName = connectionUserName;
    }

    public ConnectStatement(int beginIndex, int endIndex) {
        this.beginIndex = beginIndex;
        this.endIndex = endIndex;
    }

    @Override
    public int getBeginIndex() {
        return beginIndex;
    }

    @Override
    public int getEndIndex() {
        return endIndex;
    }

    public SimpleValueSpecification getSqlServerName() {
        return sqlServerName;
    }

    public SimpleValueSpecification getConnectionName() {
        return connectionName;
    }

    public SimpleValueSpecification getConnectionUserName() {
        return connectionUserName;
    }

    public boolean isDefault() {
        return sqlServerName == null;
    }

}
